<?php
class ModelWxappShelfanalysis extends Model {
  //获取商品信息
  public function getProductinfo($shelf_id){
    $sql = "SELECT o.name,sum(o.quantity) as num,sum(o.pay_total) as price,s.shelf_name,c.meta_title  FROM `order_product`o  LEFT JOIN `shelf` s ON s.shelf_id = o.shelf_id LEFT JOIN `category_description` c ON c.category_id = s.shelf_category WHERE o.shelf_id=".$shelf_id." group by o.product_code order by num desc  limit 20";
    $query = $this->db->query($sql);
    return $query;
  }
 public function getProductallprice($shelf_id){
    $sql = "SELECT sum(o.quantity) as num,sum(o.pay_total) as price  FROM `order_product`o  LEFT JOIN `shelf` s ON s.shelf_id = o.shelf_id LEFT JOIN `category_description` c ON c.category_id = s.shelf_category WHERE o.shelf_id=".$shelf_id." group by o.product_code order by num desc";
    $query = $this->db->query($sql)->rows;
    return $query;
  }


}
